package com.security.dataprocess.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.security.dataprocess.mapper.AlarmIndicatorThresholdMapper;
import com.security.dataprocess.model.AlarmIndicatorThreshold;
import com.security.dataprocess.service.IAlarmIndicatorThresholdService;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 传感器阈值 服务实现类
 * </p>
 *
 * @author H
 * @since 2022-12-16
 */
@Service
public class AlarmIndicatorThresholdServiceImpl extends ServiceImpl<AlarmIndicatorThresholdMapper, AlarmIndicatorThreshold> implements IAlarmIndicatorThresholdService {

    @Override
    public  IPage<AlarmIndicatorThreshold> findListByPage(Integer page, Integer pageCount){
        IPage<AlarmIndicatorThreshold> wherePage = new Page<>(page, pageCount);
        AlarmIndicatorThreshold where = new AlarmIndicatorThreshold();

        return   baseMapper.selectPage(wherePage, Wrappers.query(where));
    }

    @Override
    public int add(AlarmIndicatorThreshold alarmIndicatorThreshold){
        return baseMapper.insert(alarmIndicatorThreshold);
    }

    @Override
    public int delete(Long id){
        return baseMapper.deleteById(id);
    }

    @Override
    public int updateData(AlarmIndicatorThreshold alarmIndicatorThreshold){
        return baseMapper.updateById(alarmIndicatorThreshold);
    }

    @Override
    public AlarmIndicatorThreshold findById(Long id){
        return  baseMapper.selectById(id);
    }
}
